/******************************************************************************
*  author: hnuweiwei@gmail.com
*  version: 1.0
*  file: myStack.h
*  date: 2014.05.25
*  description: 栈的头文件声明
*  other: 无
******************************************************************************/

#ifndef MYSTACK_H_INCLUDED
#define MYSTACK_H_INCLUDED

#include<vector>
#include<stdexcept>
using namespace std;
template<typename T>
class MyStack
{
private:
    vector<T> elems; // elements

public:
    void push(T const& );// push element
    T pop();// pop element
    T top() const;// return top element
    bool isempty() const // return whether the stack is empty
    {
        return elems.empty();
    }
};


#include "myStack.cpp"

#endif // MYSTACK_H_INCLUDED


//#include<iostream>
//#include "myStack.h"
//using namespace std;

//int main()
//{
//    try
//    {
//        MyStack<int> ms;
//        ms.push(1);
//        ms.push(2);
//        ms.push(3);
//        cout<<"top of ms is "<<ms.top()<<endl;
//        ms.pop();
//        cout<<"top of ms is "<<ms.top()<<endl;
//        ms.pop();
//        ms.pop();
//        ms.pop();
//    }
//    catch(exception const& ex)
//    {
//        cerr<<"Exception has happened: "<<ex.what()<<endl;
//    }
//    return 0;
//}
